<template>
	<view>

		<view class="" style="padding: 30rpx;">
			款式:{{clothesName}} {{clothesEncode}}
		</view>

<view class="bt">
		<u-button type="primary" @click="newTask">新建一条菲码</u-button>
	</view>

		<view class="u-page">
			<u-list >
				<u-list-item v-for="(item, index) in data" :key="index">
					<u-cell>
						<template slot='label'>
							<view class="" style="display: flex;" >
								<view class="">
									<view style="margin: 10rpx;">颜色: {{item.colorName}}</view>
									<view style="margin: 10rpx;">尺码:{{item.sizeName}}</view>
									<view style="margin: 10rpx;">时间批次 {{item.createTime}}</view>
									<view style="margin: 10rpx;">需生产 {{item.num}}</view>
								</view>
								
								<view class="" >
									<!-- <u--image width="200rpx" height="200rpx" src="src(item.id)">
									  <template v-slot:loading>
									    <u-loading-icon color="red"></u-loading-icon>
									  </template>
									</u--image> -->
									<image style="height: 200rpx;width: 200rpx;" :src="src(item.id)" mode=""></image>
								</view>
							
							</view>
							
						</template>
					</u-cell>
				</u-list-item>
			</u-list>
		</view>




	

		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: [],
				id: "", //款式id
				clothesName: "",
				clothesEncode: "",
				show: false
			}
		},

		methods: {
			src(id){
				return "http://localhost:8080/code?content="+id
			},
			newTask() {
				uni.navigateTo({
					url: "/pages/generate/generate?id=" + this.id + "&clothesEncode=" + this.clothesEncode + "&clothesName=" + this.clothesName
				})
			},
			getAllTask() {
				var that = this
				this.api.get("/clothes/selectClothesTaskByClothesId/" + this.id, {}).then(res => {
					that.data = res.data
					console.log(res);
				})
			}
		},
		onLoad: function(options) {
			console.log(options)
			this.id = options.id
			this.clothesName = options.clothesName
			this.clothesEncode = options.clothesEncode
			// this.getAllTask()
		},
		onShow() {
			this.getAllTask()
		}


	}
</script>

<style scoped lang="scss">
	.bt {
		width: 90%;
		margin: 20rpx auto;
     
	}
</style>
